<?php
class MapController {
    public function __construct() {

    }

    public function saveMapToFile($args) {

        $file = realpath(DOCUMENT_ROOT) . PROJECT_BASE . SAVEPATH . "/" . $args['fileName'];

        if(!file_exists($file)) {
            touch($file);
        }
        $wrote = file_put_contents($file, serialize($args['map']));
    }

    public function loadMapFromFile($args) {

        $file = realpath(DOCUMENT_ROOT) . PROJECT_BASE . SAVEPATH . "/" . $args['fileName'];
        if(!file_exists($file)) {
            echo "Could not load file";
        } else {
            $this->tileSet = unserialize(file_get_contents($file));
        }
    }
}